package com.hg.miaosha.common.enums;

import lombok.Getter;

/**
 * 错误码枚举类
 */
@Getter
public enum ResultEnum {
	//通用模块
	SUCCESS(1, "操作成功"),
	SYSTEM_ERROR(2, "系统出现异常,请联系管理员"),
	PARAM_ERROR(3, "参数不正确");
	
	//其他模块

	private Integer code;
	private String message;

	ResultEnum(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
	
	public static ResultEnum stateOf(int index) {
		for (ResultEnum state : values()) {
			if (state.getCode() == index) {
				return state;
			}
		}
		return null;
	}
}